# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=spot
pkgver=0.3.3
pkgrel=0
pkgdesc="Native Spotify client for the GNOME desktop"
url="https://github.com/xou816/spot"
arch="aarch64 armhf armv7 ppc64le x86 x86_64"  # limited by rust/cargo
license="MIT"
makedepends="
	alsa-lib-dev
	bash
	cargo
	curl-dev
	glib-dev
	gtk4.0-dev
	libadwaita-dev
	libhandy1-dev
	meson
	nghttp2-dev
	openssl1.1-compat-dev
	pulseaudio-dev
	"
subpackages="$pkgname-lang"
source="https://github.com/xou816/spot/archive/$pkgver/spot-$pkgver.tar.gz
	pulseaudio-backend-only.patch
	"

export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"
export CARGO_PROFILE_RELEASE_PANIC="abort"

build() {
	# NOTE: buildtype must be release!
	abuild-meson \
		-Doffline=false \
		--buildtype=release \
		. output
	meson compile -j ${JOBS:-0} -C output
}

check() {
	# Meson eats stdout/stderr, so run cargo directly.
	cargo test --locked
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
8b116e5e9a79efbbb6aef21b89ca93d3ea6083fb02b245662a4e222f85feef76dbc5abcdacfb0a29bf8ee0d8062137b3f0a1648a47537b26a9c16dd7bf525a8a  spot-0.3.3.tar.gz
f790d51e5ce61f47b27c516931405a26270682066b00f807cf0f1427eabfff58b37a3c3627db1cfa53de13488f22429c410844205772020fbc27304f228fc4a1  pulseaudio-backend-only.patch
"
